home *** CD-ROM | disk | FTP | other *** search
/ Workbench Add-On / Workbench Add-On - Volume 1.iso / BBS-Archive / Dev / gcc263-src.lha / gcc-2.6.3 / config / i386 / linuxelf.h < prev    next >
C/C++ Source or Header  |  1994-10-10  |  5KB  |  108 lines

  1. /* Definitions for Intel 386 running Linux with ELF format
  2.    Written by Eric Youngdale.  */
  3.  
  4. /* A lie, I guess, but the general idea behind linux/ELF is that we are
  5.    supposed to be outputting something that will assemble under SVr4.
  6.    This gets us pretty close.  */
  7. #include "i386/i386.h"    /* Base i386 target machine definitions */
  8. #include "i386/att.h"    /* Use the i386 AT&T assembler syntax */
  9. #include "svr4.h"
  10. #undef MD_EXEC_PREFIX
  11. #undef MD_STARTFILE_PREFIX
  12. #undef TARGET_VERSION
  13. #define TARGET_VERSION fprintf (stderr, " (i386 Linux/ELF)");
  14. /* Output at beginning of assembler file.  */
  15. /* The .file command should always begin the output.  */
  16. #undef ASM_FILE_START
  17. #define ASM_FILE_START(FILE)                        \
  18.   do {                                    \
  19.     output_file_directive (FILE, main_input_filename);        \
  20.     fprintf (FILE, "\t.version\t\"01.01\"\n");            \
  21.   } while (0)
  22. /* The svr4 ABI for the i386 says that records and unions are returned
  23.    in memory.  */
  24. #undef DEFAULT_PCC_STRUCT_RETURN
  25. #define DEFAULT_PCC_STRUCT_RETURN 1
  26. /* This is how to output an element of a case-vector that is relative.
  27.    This is only used for PIC code.  See comments by the `casesi' insn in
  28.    i386.md for an explanation of the expression this outputs. */
  29. #undef ASM_OUTPUT_ADDR_DIFF_ELT
  30. #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
  31.   fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE)
  32. /* Indicate that jump tables go in the text section.  This is
  33.    necessary when compiling PIC code.  */
  34. #define JUMP_TABLES_IN_TEXT_SECTION
  35. /* Copy this from the svr4 specifications... */
  36. /* Define the register numbers to be used in Dwarf debugging information.
  37.    The SVR4 reference port C compiler uses the following register numbers
  38.    in its Dwarf output code:
  39.     0 for %eax (gnu regno = 0)
  40.     1 for %ecx (gnu regno = 2)
  41.     2 for %edx (gnu regno = 1)
  42.     3 for %ebx (gnu regno = 3)
  43.     4 for %esp (gnu regno = 7)
  44.     5 for %ebp (gnu regno = 6)
  45.     6 for %esi (gnu regno = 4)
  46.     7 for %edi (gnu regno = 5)
  47.    The following three DWARF register numbers are never generated by
  48.    the SVR4 C compiler or by the GNU compilers, but SDB on x86/svr4
  49.    believes these numbers have these meanings.
  50.     8  for %eip    (no gnu equivalent)
  51.     9  for %eflags (no gnu equivalent)
  52.     10 for %trapno (no gnu equivalent)
  53.    It is not at all clear how we should number the FP stack registers
  54.    for the x86 architecture.  If the version of SDB on x86/svr4 were
  55.    a bit less brain dead with respect to floating-point then we would
  56.    have a precedent to follow with respect to DWARF register numbers
  57.    for x86 FP registers, but the SDB on x86/svr4 is so completely
  58.    broken with respect to FP registers that it is hardly worth thinking
  59.    of it as something to strive for compatibility with.
  60.    The verison of x86/svr4 SDB I have at the moment does (partially)
  61.    seem to believe that DWARF register number 11 is associated with
  62.    the x86 register %st(0), but that's about all.  Higher DWARF
  63.    register numbers don't seem to be associated with anything in
  64.    particular, and even for DWARF regno 11, SDB only seems to under-
  65.    stand that it should say that a variable lives in %st(0) (when
  66.    asked via an `=' command) if we said it was in DWARF regno 11,
  67.    but SDB still prints garbage when asked for the value of the
  68.    variable in question (via a `/' command).
  69.    (Also note that the labels SDB prints for various FP stack regs
  70.    when doing an `x' command are all wrong.)
  71.    Note that these problems generally don't affect the native SVR4
  72.    C compiler because it doesn't allow the use of -O with -g and
  73.    because when it is *not* optimizing, it allocates a memory
  74.    location for each floating-point variable, and the memory
  75.    location is what gets described in the DWARF AT_location
  76.    attribute for the variable in question.
  77.    Regardless of the severe mental illness of the x86/svr4 SDB, we
  78.    do something sensible here and we use the following DWARF
  79.    register numbers.  Note that these are all stack-top-relative
  80.    numbers.
  81.     11 for %st(0) (gnu regno = 8)
  82.     12 for %st(1) (gnu regno = 9)
  83.     13 for %st(2) (gnu regno = 10)
  84.     14 for %st(3) (gnu regno = 11)
  85.     15 for %st(4) (gnu regno = 12)
  86.     16 for %st(5) (gnu regno = 13)
  87.     17 for %st(6) (gnu regno = 14)
  88.     18 for %st(7) (gnu regno = 15)
  89. */
  90. #undef DBX_REGISTER_NUMBER
  91. #define DBX_REGISTER_NUMBER(n) \
  92. ((n) == 0 ? 0 \
  93.  : (n) == 1 ? 2 \
  94.  : (n) == 2 ? 1 \
  95.  : (n) == 3 ? 3 \
  96.  : (n) == 4 ? 6 \
  97.  : (n) == 5 ? 7 \
  98.  : (n) == 6 ? 5 \
  99.  : (n) == 7 ? 4 \
  100.  : ((n) >= FIRST_STACK_REG && (n) <= LAST_STACK_REG) ? (n)+3 \
  101.  : (-1))
  102. #define LINUX_ELF
  103. #include "i386/linux.h"
  104.  
  105. #undef YES_UNDERSCORE
  106. #undef DBX_DEBUGGING_INFO
  107. #define DWARF_DEBUGGING_INFO
  108.